package com.xjl.generated;

import com.fasterxml.uuid.EthernetAddress;
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.impl.TimeBasedGenerator;

import java.util.UUID;

/**
 * Created by xiaojinlu1990@163.com on 2019/12/15.
 * 生成简单的服务 简单的id
 */

public class SimpleId {
    /**
     *     java.util.UUID
     * @return
     */
    public static String getUtilUUID(){
        return UUID.randomUUID().toString();
    }
    public static String generatorUUID(){
        TimeBasedGenerator timeBasedGenerator = Generators.timeBasedGenerator(EthernetAddress.fromInterface());
        return timeBasedGenerator.generate().toString();
    }

    public static void main(String[] args) {
        for (int i = 0; i < 50; i++) {
            System.out.println(getUtilUUID());
        }
        System.out.println("---------------------------------");
        for (int i = 0; i < 50; i++) {
            System.out.println(generatorUUID());
        }
    }





}
